package huachenxing.mimi520.skin
{
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFieldType;

	public class Input extends ControlBorder
	{
		private var _field:Text;
		
		override protected function invoke():void
		{
			super.invoke();
			
			_field = new Text();
			_field.mouseEnabled = true;
			_field.color = 0;
			_field.type = TextFieldType.INPUT;
			_field.autoSize = TextFieldAutoSize.NONE;
			_field.x = 4;
			addChild(_field);
			
			height = 30;
		}
		
		override public function dispose():void
		{
			removeChild(_field);
			_field.dispose();
			_field = null;
			
			super.dispose();
		}
		
		public function get textSize():uint
		{
			return _field.size;
		}
		public function set textSize(value:uint):void
		{
			_field.size;
		}
		
		public function get textColor():uint
		{
			return _field.color;
		}
		public function set textColor(value:uint):void
		{
			_field.color = value;
		}
		
		public function get text():String
		{
			return _field.text;
		}
		public function set text(value:String):void
		{
			_field.text = value;
		}
		
		override protected function draw():void
		{
			super.draw();
			
			_field.width = width - _field.x * 2;
			_field.height = _field.textHeight + 6;
			_field.y = (height - _field.height) * .5;
		}
	}
}